package com.aijk.commons.group;

import java.util.ArrayList;
import java.util.List;

public class GroupResults<K,E> {
    private List<GroupResult<K,E>> groupResults = new ArrayList<GroupResult<K,E>>();

    public List<GroupResult<K,E>> getGroupResults() {
        return groupResults;
    }

    public boolean isEmpty() {
        return groupResults.isEmpty();
    }

    public void add(GroupResult<K,E> groupedResult) {
        groupResults.add(groupedResult);
    }

    public GroupResult<K,E> getGroupResult(K key) {
        for (GroupResult<K,E> groupResult : groupResults) {
            if (key.equals(groupResult.getKey())) {
                return groupResult;
            }
        }
        return null;
    }
}
